package com.zhongjianjian.zookeeper.dao;

import com.zhongjianjian.redisLock.entity.TestStock;
import org.apache.ibatis.annotations.Mapper;
import com.zhongjianjian.redisLock.entity.TestStock;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

import java.util.Map;

/**
 * @类名: com.zhongjianjian.zookeeper.dao
 * @作者: lgt
 * @创建时间: 2020-02-28 19:34
 * @描述:
 **/
@Mapper
public interface ZkStockDao {


    @Select("select * from base_stock where goods_id=#{goodsId}")
    @Results( value = {
            @Result(property = "goodsId",column = "goods_id",jdbcType = JdbcType.BIGINT),
            @Result(property = "stock",column = "stock",jdbcType = JdbcType.INTEGER),
            @Result(property = "createDate",column = "create_time",jdbcType = JdbcType.DATE)
    }
    )
    public TestStock getStock(Map<String,String> param);

    /**
     * 更新库存
     * @param testStock
     * @return
     */
    @Update("update base_stock set stock=#{stock} where goods_id=#{goodsId}")
    public int updateStock(TestStock testStock);
}
